<div id="maincontent">

<%= render :partial => "shared_common_files/data_area_help_bar" %>

<h2>Feed > Subscribers</h2>
<!-- h5>Click on "show subscribers" on respective feeds in your list of feeds </h5 -->	
  
    <% for name in [:notice, :warning, :message] %>
        <% if flash[name] %>
          <%= "<div class='message-fatal'> #{flash[name]} </div>" %>
        <% end %>
    <% end %>
  
    <% if(@feedsubscribers==nil and @showFeedList)%>
        <h5>Click on "show subscribers" on respective feeds in your list of feeds </h5>	
        <div class="list">
	       <table>
		      <tr>
			     <td class="pagination" colspan="5"> <!-- pagination will be here --> <%=pagination_links @feed_pages%></td>
		      </tr>

           <% count=1;%>
           <% for column in Feed.content_columns %>
                <%if(column.human_name!='Guid')%>
                    <th><%= column.human_name %></th>
                <% end %>
           <% end %>		
	  
	       <th>Action</th>

            <% count=1;%>	  
            <% rowtype="odd";%>
            <% for entry in @feeds %>
                <%if(isodd(count))%>
                    <% rowtype="odd";%>
                <%else%>
                    <% rowtype="even";%>
                <%end%>     
                
                <tr class="<%=rowtype%>">
                    <% for column in Feed.content_columns %>
                        <%if(column.human_name!='Guid')%>
                            <td>
                            <% if column.name == "feed_url"%>
                            <a href=<%= entry.send(column.name)%>><%=entry.send(column.name)%></a>
                            <%else%>
                            <%= entry.send(column.name) %>
                            <%end%>
                            
                            </td>
                        <% end %>
                    <% end %>
                    
                    <td>
                        <%= link_to image_tag('/themes/odotclassic/images/system-users.png', :title => 'Show Subscribers'),  {:action => 'listsubscribers', :feedid => entry} %>
                    </td>
                </tr>
                
                <% count = count + 1 %>
            <% end %>
	
	       </table>
        </div>

        <br /><br /><br />

        <div class="list">
            <%= start_form_tag({:action => 'newfeed'}, :method=>'get') %>
        	<table>
        	     <th>Action</th>
                 <tr class="even">
                    <td>
                        <!-- %= link_if_authorized submit_tag('Cancel'), {:action => 'list'}  % -->
                        <%= link_if_authorized image_tag('/themes/odotclassic/images/btn_cancel.gif', :alt => 'Cancel' ), {:action => 'list'}%>
                    </td>
                 </tr>        
        	</table>
        	<%= end_form_tag %>
        </div>

    <%end%>

    <% if(@feedsubscribers!=nil)%>

    <h3>Subscribers for <a href=<%=@feed.feed_url%>><%=@feed.feed_url%></a></h3>

    <div class="list">
	   <table>
		  <tr>
			<td class="pagination" colspan="5"></td>
		  </tr>
		  
		  <th>User email address</th>
          
          <% count=1;%>	  
          <% rowtype="odd";%>
  
          <% for entry_subs in @feedsubscribers %>
            <%if(isodd(count))%>
                <% rowtype="odd";%>
            <%else%>
                <% rowtype="even";%>
            <%end%>     
            
            <tr class="<%=rowtype%>">
                <td><%=entry_subs.email%></td>
            </tr>
            
            <% count = count + 1 %>
          <%end%>
    
          <%if(@feedsubscribers.size==0)%>
			<tr>
       			<td>No subscribers yet for this feed.</td>
			</tr>
          <%end%>
       </table> 
    </div>
    
    <br /><br /><br />

    <div class="list">
        
    	<table>
    	     <th>Actions</th>
             <tr class="even">
                <td>
                    <!-- %= link_if_authorized submit_tag('List Feeds'), {:action => 'list'}  % -->
                    <!-- %= link_if_authorized submit_tag('Cancel'), {:action => 'listsubscribers'}  % -->
                    <!-- input type="button" value="Cancel" onclick="javascript:history.go(-1);"/ -->
                    
                    <%= link_if_authorized image_tag('/themes/odotclassic/images/btn_listfeeds.png', :alt => 'List' ), {:action => 'list'}%>
                    <%= link_if_authorized image_tag('/themes/odotclassic/images/btn_cancel.gif', :alt => 'Cancel' ), {:action => 'listsubscribers'}%>
                    
                </td>
             </tr>        
    	</table>
    	
    </div>
    
    <%end%>

</div>